<?php if (!defined('THINK_PATH')) exit(); /*a:4:{s:87:"/www/wwwroot/58datas.nethump.com/public/../application/admin/view/logs/index/index.html";i:1583371236;s:75:"/www/wwwroot/58datas.nethump.com/application/admin/view/layout/default.html";i:1576638344;s:72:"/www/wwwroot/58datas.nethump.com/application/admin/view/common/meta.html";i:1576638344;s:74:"/www/wwwroot/58datas.nethump.com/application/admin/view/common/script.html";i:1576638344;}*/ ?>
<!DOCTYPE html>
<html lang="<?php echo $config['language']; ?>">
    <head>
        <meta charset="utf-8">
<title><?php echo (isset($title) && ($title !== '')?$title:''); ?></title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
<meta name="renderer" content="webkit">

<link rel="shortcut icon" href="/assets/img/favicon.ico" />
<!-- Loading Bootstrap -->
<link href="/assets/css/backend<?php echo \think\Config::get('app_debug')?'':'.min'; ?>.css?v=<?php echo \think\Config::get('site.version'); ?>" rel="stylesheet">

<!-- HTML5 shim, for IE6-8 support of HTML5 elements. All other JS at the end of file. -->
<!--[if lt IE 9]>
  <script src="/assets/js/html5shiv.js"></script>
  <script src="/assets/js/respond.min.js"></script>
<![endif]-->
<script type="text/javascript">
    var require = {
        config:  <?php echo json_encode($config); ?>
    };
</script>
    </head>

    <body class="inside-header inside-aside <?php echo defined('IS_DIALOG') && IS_DIALOG ? 'is-dialog' : ''; ?>">
        <div id="main" role="main">
            <div class="tab-content tab-addtabs">
                <div id="content">
                    <div class="row">
                        <div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
                            <section class="content-header hide">
                                <h1>
                                    <?php echo __('Dashboard'); ?>
                                    <small><?php echo __('Control panel'); ?></small>
                                </h1>
                            </section>
                            <?php if(!IS_DIALOG && !$config['fastadmin']['multiplenav']): ?>
                            <!-- RIBBON -->
                            <div id="ribbon">
                                <ol class="breadcrumb pull-left">
                                    <li><a href="dashboard" class="addtabsit"><i class="fa fa-dashboard"></i> <?php echo __('Dashboard'); ?></a></li>
                                </ol>
                                <ol class="breadcrumb pull-right">
                                    <?php foreach($breadcrumb as $vo): ?>
                                    <li><a href="javascript:;" data-url="<?php echo $vo['url']; ?>"><?php echo $vo['title']; ?></a></li>
                                    <?php endforeach; ?>
                                </ol>
                            </div>
                            <!-- END RIBBON -->
                            <?php endif; ?>
                            <div class="content">
                                <!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>同步登录58同城</title>
    <link rel="stylesheet" href="/assets/css/login58.css">
    <script src="https://cdn.bootcss.com/jquery/3.4.1/jquery.min.js"></script>

</head>
<body>
<form id="add-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
    <div class="pop_mask">
        <div class="passwordlogin" style="display: block;">
            <div class="change">
                <span id="phonenum" class="active">手机动态码登录</span>
                <div class="clear"></div>
            </div>
            <div class="phonenumlogin" style="display: block;">
                <div class="item phonenumlogin_item_phone">
                    <input type="text" name="row[mobile]" id="c-mobile" placeholder="手机号" maxlength="11">
                    <span class="getcode">获取动态码</span>
                    <div class="phone_msg msg"><span class="phone_msgtext">请输入正确的手机号</span>
                        <div class="clear"></div>
                    </div>
                    <div class="clear"></div>
                </div>
                <div class="item">
                    <input type="text" name="row[code]" id="c-code" placeholder="动态码" maxlength="6">
                    <div class="mobilecode_msg msg"><span class="mobilecode_msgtext"></span>
                        <div class="clear"></div>
                    </div>
                </div>
                <div class="item">
                    <button id="btn_phonenum" type="submit" class="btn">登录</button>
                    <!--<div class="protocol">登录即同意<a target="_blank"-->
                    <!--                              href="//about.58.com/home2/home_pc/syxyjgg/771.html">《58同城使用协议》</a>&amp;<a-->
                    <!--        target="_blank" href="//helpcenter.58.com/helpcenter_pc/yhfwxy/724.html">《隐私政策》</a></div>-->
                </div>

            </div>
        </div>
    </div>
</form>
<input type="hidden" id="url58" value="<?php echo $url58; ?>">
<script>
    function validatePhone() {
        let phone = $.trim($('#c-mobile').val())
        let reg = /^1[3|5|6|7|8|9][0-9]{9}$/; //电话号码验证规则

        let res = phone.length == 0 || !reg.test(phone)
        if (res) { //如果电话号码为空或者电话号码输入不正确
            $('.phone_msg').css('display', 'block')
        } else {
            $('.phone_msg').css('display', 'none')
        }
        return res
    }

    function validateCode() {
        let code = $.trim($('#c-code').val())
        if (code.length == 0) {
            $('.mobilecode_msg').css('display', 'block')
            $('.mobilecode_msgtext').html('请先获取动态码')
        } else {
            $('.mobilecode_msg').css('display', 'none')
        }
        return code.length == 0 ? true : false
    }

    $(function () {
        // 倒计时
        let code = true; //表示验证码已经发送
        $('.getcode').click(function () {
            if (!validatePhone()) { //如果电话号码输入正确，则验证码发送成功，倒计时开始
                let timer = 61;
                var url58 = $('#url58').val();
                console.log('url58');
                console.log(url58);
                var mobile = $.trim($('#c-mobile').val());
                //获取58接口请求
                $.ajax({
                    url: url58 + "/api/phone_login",
                    data:{
                        'phone':mobile
                    },
                    type: 'post',
                    dataType: 'json',
                    success:function(result){
                    	if(result.code == 0){
                    		 if (code) {
				                    code = false;//表示当验证码发送完成后，发送按钮不可点击
				                    let n = setInterval(function () {
				                        timer--;
				                        $('.getcode').html(timer + 's后重新获取');
				                        if (timer == 0) {
				                            clearInterval(n);
				                            code = true;//当倒计时为0时，即可重新发送验证码
				                            $('.getcode').html('重新获取')
				                        }
				                    }, 1000)
				                }
                    	}else{
                    		alert(result.msg);
                    	}
                        
                    }});
               
            }
        })
        // 手机号失焦
        $('#c-mobile').blur(function () {
            validatePhone()
        })
        // 验证码失焦
        $("#c-code").blur(function () {
            validateCode()
        })

        $("#c-code").bind("input propertychange change", function (event) {
            //代码块
            if ($.trim($('#mobilecode').val()).length > 0 && !validatePhone()) {
                $('#btn_phonenum').css('color', 'rgb(255, 255, 255)')
            } else {
                $('#btn_phonenum').css('color', 'rgba(255, 255, 255,.5)')
            }
        })

        // //登录
        // $('.btn').click(function () {
        //     let resPhone = validatePhone()
        //     let resCode = validateCode()
        //     console.log(resPhone)
        //     console.log(resCode)
            
        //     if (!resPhone && !resCode) {
        //     	var mobile = $.trim($('#c-mobile').val());
        //     	var code = $.trim($('#c-code').val());
        //     	var url58 = $('#url58').val();
	       //     console.log(mobile)
	       //     console.log(code)
        // 		console.log(url58)
        //          $.ajax({
        //             url: url58 + "/api/send_code",
        //             data:{
        //                 'phone':mobile,
        //                 'code':code
        //             },
        //             type: 'post',
        //             dataType: 'json',
        //             success:function(result){
        //             	console.log(result)
        //             	if(result.code == 0){
        //             		 alert(result.msg);
        //             		 //window.location.href = "/dashboard/index";
        //             	}else{
        //             		alert(result.msg);
        //             	}
                        
        //             }});
        //     }

        // })

    })
</script>
</body>
</html>

                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <script src="/assets/js/require<?php echo \think\Config::get('app_debug')?'':'.min'; ?>.js" data-main="/assets/js/require-backend<?php echo \think\Config::get('app_debug')?'':'.min'; ?>.js?v=<?php echo htmlentities($site['version']); ?>"></script>
    </body>
</html>